package co.yixiang.modules.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @author db
* @date 2020-10-22
*/
@Data
@Accessors(chain = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("g_main_income")
public class MainIncome implements Serializable {

    @TableId
    private Integer id;


    /** 关联合伙人 id */
    @NotNull
    private Integer userId;


    /** 总收益 */
    @NotNull
    private BigDecimal totalIncome;


    /** 今日收益 */
    @NotNull
    private BigDecimal todayIncome;


    /** 昨日收益 */
    @NotNull
    private BigDecimal lastIncome;


    /** 本月收益 */
    @NotNull
    private BigDecimal monthIncome;


    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    private LocalDateTime createDate;


    /** 修改时间 */
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private LocalDateTime updateDate;


    public void copy(MainIncome source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
